import { get, getBlob } from '@/utils/http';
import {
  GetListEmissionTaskResult,
  GetListEmissionDataParams,
  GetListEmissionDataResult
} from './model/detailModel';

enum Api {
  // 碳排放核算查询条件获取
  GET_LIST_EMISSION_TASK = '/inventory/carbonData/listEmissionTask',
  // 碳排放核算明细
  GET_LIST_EMISSION_DATA = '/inventory/carbonData/listEmissionData',
  // 碳排放核算导出
  EXPORT_EMISSION_DATA = '/inventory/carbonData/exportEmissionData'
}

/**
 * 碳排放核算查询条件获取
 * @returns
 */
export const getListEmissionTask = (): Promise<GetListEmissionTaskResult[]> =>
  get(Api.GET_LIST_EMISSION_TASK);

// 碳排放核算明细
export const getListEmissionData = (
  params: GetListEmissionDataParams
): Promise<GetListEmissionDataResult[]> => get(Api.GET_LIST_EMISSION_DATA, params);

// 碳排放核算导出
export const exportEmissionData = (params: GetListEmissionDataParams) =>
  getBlob(Api.EXPORT_EMISSION_DATA, params);
